from rest_framework import serializers
from certificate_manager.models import CollectCate
from .cate import CateSerializer

class CollectCateSerializer(serializers.ModelSerializer):
        
        class Meta:
                model = CollectCate
                fields = ['pk', 'cate', 'start_date', 'end_date']

        def to_representation(self, ccate):
            ret = super().to_representation(ccate)
            ret['cate'] = CateSerializer(ccate.cate).data
            return ret
         
